#ifndef frm_control_TDouble_H
#define frm_control_TDouble_H

#include "svl_TVariant.h"
#include "frm_control_TString.h"

namespace frm { namespace control {

///////////////////////////////////////////////////////////////////////////////

struct TDouble : public TString
{
  TDouble(TWindow &Window) : TString(Window),Precision(6),enableEdit(true) { }
  //
  bool IsNull()  { return TString::GetValue().Len() == 0; }
  void SetNull() { TString::SetValue(""); }
  //
  void SetValue(svl::TVariant V);
  //
  void SetEnableEdit(bool V) { enableEdit = V;}
  void   SetValue(double V);
  double GetValue() { return TString::GetValue().ConvertToDouble(); }
  void   SetPrecision(int P);
  //
  virtual bool UpdateValue(svl::TString V);

protected:
  virtual void TComponent_KeyboardKey (grf::TKeyboardKey  &KeyboardKey);
  virtual void TComponent_KeyboardChar(grf::TKeyboardChar &KeyboardChar);
  virtual void TComponent_FocusEnter()  { TString::TComponent_FocusEnter(); }
  virtual void TComponent_FocusExit();
  virtual bool TComponent_FocusEnable() { return enableEdit;}

  //
  int Precision;
  bool enableEdit;
  char* ConvertDoubleToString( double d, int p );
};

///////////////////////////////////////////////////////////////////////////////
}}

#endif
